import axios from '@/libs/api.request'

export const updateCrontabSchedule = (crontab) => {
  return axios.request({
    url: `api/CeleryScheduledTaskService/crontab_schedule/${crontab.id}/`,
    data: crontab,
    method: 'patch'
  })
};

export const deleteCrontabSchedule = (id) => {
  return axios.request({
    url: `api/CeleryScheduledTaskService/crontab_schedule/${id}/`,
    method: 'delete'
  })
};

export const getCrontabSchedules = (val) => {
  return axios.request({
    url: 'api/CeleryScheduledTaskService/crontab_schedule/',
    params: val,
    method: 'get'
  })
};

export const createCrontabSchedule = (crontab) => {
  return axios.request({
    url: 'api/CeleryScheduledTaskService/crontab_schedule/',
    data: crontab,
    method: 'post'
  })
}
